package com.els.test;

import java.io.UnsupportedEncodingException;

import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;

import com.els.Elastic;

public class ElsTestMain {
	public static void main(String[] args) throws UnsupportedEncodingException {
		Elastic elastic=new Elastic();
		Client client = elastic.getClient();
		SearchResponse sr = client.prepareSearch("hmd_storeinfo").setTypes("store")
			.setQuery(QueryBuilders.matchAllQuery())
			.execute().actionGet();
		for (SearchHit hit : sr.getHits().getHits()) {
			String nameString=(String) hit.getSource().get("storeName");
			System.out.println(nameString);
		}
	}
}
